<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('快捷文本')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-quick-text">
			<div class="form-group">
				<label class="col-sm-3 control-label">处理意见1：</label>
				<div class="col-sm-8">
					<input id="quickText1" name="quickText1"  class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">处理意见2：</label>
				<div class="col-sm-8">
					<input id="quickText2" name="quickText2" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">处理意见3：</label>
				<div class="col-sm-8">
					<input id="quickText3" name="quickText3" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">处理意见4：</label>
				<div class="col-sm-8">
					<input id="quickText4" name="quickText4" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">处理意见5：</label>
				<div class="col-sm-8">
					<input id="quickText5" name="quickText5" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script  th:inline="javascript">
		var prefix = ctx + "system/tagAlarmData";
		$(function(){
			$('input:not([autocomplete]),textarea:not([autocomplete]),select:not([autocomplete])').attr('autocomplete', 'off');
		});
		var alarmQuickTextList = [[${alarmQuickTextList}]];
		$(function () {
			if (alarmQuickTextList.length>0){
				for (i=0;i<alarmQuickTextList.length;i++){
					$("#quickText"+(i+1)).val(alarmQuickTextList[i].quickText);
				}
			}
		})
		function submitHandler() {
			var quickText1 = $("#quickText1").val();
			var quickText2 = $("#quickText2").val();
			var quickText3 = $("#quickText3").val();
			var quickText4 = $("#quickText4").val();
			var quickText5 = $("#quickText5").val();
			var list = new Array();
			if (quickText1!=null&&quickText1!=""){
				if (quickText1.length>100){
					$.modal.alertError("“处理意见1”请输入100字以内");
					return;
				}
				list.push(quickText1);
			}
			if (quickText2!=null&&quickText2!=""){
				if (quickText2.length>100){
					$.modal.alertError("“处理意见2”请输入100字以内");
					return;
				}
				list.push(quickText2);
			}
			if (quickText3!=null&&quickText3!=""){
				if (quickText3.length>100){
					$.modal.alertError("“处理意见3”请输入100字以内");
					return;
				}
				list.push(quickText3);
			}
			if (quickText4!=null&&quickText4!=""){
				if (quickText4.length>100){
					$.modal.alertError("“处理意见4”请输入100字以内");
					return;
				}
				list.push(quickText4);
			}
			if (quickText5!=null&&quickText5!=""){
				if (quickText5.length>100){
					$.modal.alertError("“处理意见5”请输入100字以内");
					return;
				}
				list.push(quickText5);
			}
			var data=null;
			if (list.length>0){
				data = {
					alarmQuickTexts:list
				}
			}
			var url = prefix+"/saveQuickText";
			var config = {
				url: url,
				type: "post",
				dataType: "json",
				data: "list="+list,
				beforeSend: function () {
					$.modal.loading("正在处理中，请稍后...");
					$.modal.disable();
				},
				success: function(result) {
					parent.location.reload();
					$.operate.successCallback(result);
				}
			};
			$.ajax(config)
		}
	</script>
</body>
</html>
